package com.sfx.admin.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sfx.admin.common.convention.result.Result;
import com.sfx.admin.remote.dto.req.*;
import com.sfx.admin.remote.dto.resp.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("short-link-project")
public interface ShortLinkActualRemoteService {

    /**
     * 创建短连接
     *
     * @param requestParam 入参
     * @return 返回参数
     */
    @PostMapping("/api/short-link/v1/create")
    Result<ShortLinkCreateRespDTO> createShortLink(@RequestBody ShortLinkCreateReqDO requestParam);


    @GetMapping("/api/short-link/v1/page")
    Result<Page<ShortLinkPageRespDTO>> shortLinkPage(@RequestParam("gid") String gid,
                                                     @RequestParam("orderTag") String orderTag,
                                                     @RequestParam("current") long current,
                                                     @RequestParam("size") long size);

    @GetMapping("/api/short-link/v1/count")
    Result<List<ShortLinkGroupCountRespDTO>> getGroupShortLinkCount(@RequestParam("requestParam") List<String> requestParam);


    /**
     * 修改短链接
     *
     * @param requestParam 请求入参
     * @return 无返回值
     */
    @PostMapping("/api/short-link/v1/update")
    Result<Void> updateShortLink(@RequestBody ShortLinkUpdateReqDTO requestParam);


    @PostMapping("/api/short-link/v1/recycle-bin/save")
    void saveRecycleBin(@RequestBody SaveRecycleBinReqDTO requestParam);

    @GetMapping("/api/short-link/v1/recycle-bin/page")
    Result<Page<PageRecycleBinRespDTO>> pageRecycleBin(@RequestParam("current") long current,
                                                       @RequestParam("size") long size);


    @PostMapping("/api/short-link/v1/recycle-bin/recover")
    void recoverRecycleBin(@RequestBody RecoverRecycleBinReqDTO requestParam);


    @PostMapping("/api/short-link/v1/recycle-bin/remove")
    void removeRecycleBin(@RequestBody RemoveRecycleBinReqDTO requestParam);


    /**
     * 访问单个短链接指定时间内监控数据  full-short_url + gid(单个短链接)
     */
    @GetMapping("/api/short-link/v1/stats")
    Result<ShortLinkStatsRespDTO> shortLinkStats(ShortLinkStatsReqDTO requestParam);

    /**
     * 访问单个短链接指定时间内访问记录监控数据
     */
    @GetMapping("/api/short-link/v1/stats/access-record")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> shortLinkStatsAccessRecord(@RequestParam("gid") String gid,
                                                                               @RequestParam("current") long current,
                                                                               @RequestParam("size") long size);

    /**
     * 访问分组短链接指定时间内监控数据
     */
    @GetMapping("/api/short-link/v1/stats/group")
    Result<ShortLinkStatsRespDTO> groupShortLinkStats(@RequestParam("gid") String gid,
                                                      @RequestParam("startDate") String startDate,
                                                      @RequestParam("endDate") String endDate);

    /**
     * 访问分组短链接指定时间内访问记录监控数据
     */
    @GetMapping("/api/short-link/v1/access-record/group")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> groupShortLinkStatsAccessRecord(@RequestParam("gid") String gid,
                                                                                    @RequestParam("startDate") String startDate,
                                                                                    @RequestParam("endDate") String endDate);
}